Repository navigation
feat(core): a paired machine needs no approval - #65356
Conversation
There was a problem hiding this comment.
I recommend merging this. The change is sound, and I found nothing that should block it.
How I checked it: I ran the PR's updated machine-path.test.ts against the base. The new end-to-end test (read, write and a shell command on a paired gpu with default rules) stalls on an approval request until it times out, and allow("*") still evaluates to ask for gpu:/work/a.txt. With the PR, machine-path.test.ts and permission.test.ts pass (198 tests) and tsc -b in packages/core is clean. I didn't drive the TUI, because that would need a real paired machine.
Code: Dropping the special case in evaluate means machine resources go through the normal last-match rules. Rules naming the machine (gpu:* for ask or deny), global denies (e.g. plan mode's edit: deny) and the .env asks still apply. Local path globs like /work/* still don't match gpu:/work/..., because the gpu: prefix stays on the resource. Unknown and removed machines still fail before any permission check.
Tradeoff, as the description says: an "always" answer saved on this computer before this change (for example the * saved for edits) now covers paired machines without asking. That's a product decision for the team, not a bug.
Public API: unchanged. No config, schema, SDK, HTTP or plugin surface changes; only how existing rules are evaluated, behind the machines flag.
Pairing a machine is the consent to use it: a path on a paired machine is judged like a local path.
Until now every first use of a machine asked for approval, once per machine per project, for computers the owner paired on purpose and could already reach with
sshfrom the local shell without a prompt.🚦 Flag:
machines. Paths that are not on a machine behave as before.🐛 Before → after
gpuaskordenynaming the machine (gpu:*)askor shelldeny*.env.*on a machine*.env.exampleis allowed, as locally (it was not before)The change is a removal (+2 −11 in
packages/core/src). There was no built-in external-directoryask: the prompt came only from the special case, which filtered the default allow and fell back toask.*an "always" answer to a local edit saves, now covers machines too, exactly as it covers local paths. A rule naming a machine is the way to keep one guarded. Whether pairing should take a scope is an open question for the team; this is the default for now.📊 Proof
askanddeny, global edit and shell restrictions,.envexceptions, saved-rule precedencemachine-path.test.tsandpermission.test.ts×5,bun typecheckinpackages/coregpu:*does not matchgpu2:/x👀 Read:
packages/core/src/permission.ts, the removed block inevaluate.Follows #65349